//
//  LSZAnswerQuestionsDetailsManager.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/9/6.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZAnswerQuestionsDetailsManager.h"

@implementation LSZAnswerQuestionsDetailsManager
-(id)initWithAnswerQuestionsDetails:(NSArray *)array
{
    self = [super init];
    if (self) {
        self.arrayData = [[NSMutableArray alloc]init];
        NSMutableArray * mutArrayAdd = [[NSMutableArray alloc]init];
        for (NSDictionary * diction in array) {
            LSZAnswerQuestionsDetailsMg * mg = [[LSZAnswerQuestionsDetailsMg alloc]init];
            mg.examType = NullStringjudgment(NSStr(diction[@"examType"]));
            mg.name = NullStringjudgment(NSStr(diction[@"name"]));
            mg.score = NullStringjudgment(NSStr(diction[@"score"]));
            mg.sortIndex = NullStringjudgment(NSStr(diction[@"sortIndex"]));
            mg.id_id = NullStringjudgment(NSStr(diction[@"id"]));
            NSString * strAnswer = NullStringjudgment(NSStr(diction[@"answer"]));
            
            NSString *stringWithoutQuotation = [strAnswer stringByReplacingOccurrencesOfString:@"[" withString:@""];
            NSString *stringWithoutQuotationTwo = [stringWithoutQuotation stringByReplacingOccurrencesOfString:@"]" withString:@""];
            mg.answer = stringWithoutQuotationTwo;
            id content =  NullStringjudgment(NSStr(diction[@"content"]));
            NSArray * arrayAnswer = [LSZSpecialPackaging stringToJSON:content];

            NSMutableArray * arrayMut = [[NSMutableArray alloc]init];
 
            if ([arrayAnswer isKindOfClass:[NSArray class]]) {
                for (NSDictionary * dic in arrayAnswer) {
                    [arrayMut addObject: NullStringjudgment(NSStr(dic[@"content"]))];
                }
            }
            mg.arrayContent = arrayMut;
            mg.addAnswerArray = [[NSMutableArray alloc]init];
            mg.number = -1;
            [mutArrayAdd addObject:mg];
        }
        self.arrayData = mutArrayAdd;
    }
    return self;
}

@end
@implementation LSZAnswerQuestionsDetailsMg

@end
